﻿using Sidvall.UI.ViewModels;
using System.Windows.Controls;

namespace Sidvall.UI.Wpf.Controls
{
    public partial class PingFederateIdentityProviderControl : UserControl
    {
        #region Public Members

        public event System.EventHandler GoBackSelected;
        public event System.EventHandler LogOnSelected;

        #region ViewModel

        public PingFederateIdentityProviderControlViewModel ViewModel
        {
            get
            {
                return (PingFederateIdentityProviderControlViewModel)this.DataContext;
            }
            set
            {
                this.DataContext = value;
            }
        }

        public object IdentityProvider { get; private set; }

        #endregion

        #region GetPassword

        public string GetPassword()
        {
            return this.PasswordBox.Password;
        }

        #endregion

        #endregion
        #region Private Members

        #region OnGoBackSelected

        private void OnGoBackSelected()
        {
            OnGoBackSelected(new System.EventArgs());
        }
        private void OnGoBackSelected(System.EventArgs args)
        {
            OnGoBackSelected(this, args);
        }
        private void OnGoBackSelected(object sender, System.EventArgs args)
        {
            if (this.GoBackSelected != null)
                this.GoBackSelected.Invoke(sender, args);
        }

        #endregion
        #region OnLogOnSelected

        private void OnLogOnSelected()
        {
            OnLogOnSelected(new System.EventArgs());
        }
        private void OnLogOnSelected(System.EventArgs args)
        {
            OnLogOnSelected(this, args);
        }
        private void OnLogOnSelected(object sender, System.EventArgs args)
        {
            if (this.LogOnSelected != null)
                this.LogOnSelected.Invoke(sender, args);
        }

        #endregion

        #endregion
        #region Events

        #region GoBack_Click

        private void GoBack_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            OnGoBackSelected();
        }

        #endregion
        #region LogOn_Click

        private void LogOn_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            OnLogOnSelected();
        }

        #endregion

        #endregion
        #region Constructors

        public PingFederateIdentityProviderControl()
        {
            InitializeComponent();
        }

        #endregion
    }
}
